/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package phd.dupenois.changeidentifiers.optimisation.singlepattern;

import phd.dupenois.changeidentifiers.ChangeIdentifierSet;
import phd.dupenois.es.nplusn.Solution;
import phd.dupenois.es.nplusn.SolutionClass;

/**
 *
 * @author mpd209
 */
public class ChangeIdentifierSolution extends Solution{
    private static SolutionClass solutionClass;
    private ChangeIdentifierSet changeIdentifierSet;
    public final static String TIME_TAKEN_LABEL =  "timeTaken";
    public final static String SYMMETRIC_ERROR_LABEL =  "symmetricError";
    public final static String TIME_TAKEN_BASELINE_LABEL =  "timeTakenBaseline";
    private static double TIME_TAKEN_BASELINE_VALUE;

    public ChangeIdentifierSolution(ChangeIdentifierSet changeIdentifierSet){
        super(ChangeIdentifierSolution.getClassType());
        this.changeIdentifierSet = changeIdentifierSet;

    }

    public double getSymmetricError(){
        return this.getObjectiveResult(SYMMETRIC_ERROR_LABEL).getValue().doubleValue();
    }
    public double getTimeTaken(){
        return this.getObjectiveResult(TIME_TAKEN_LABEL).getValue().doubleValue();
    }
    public static SolutionClass getClassType(){
        if(solutionClass!=null)return solutionClass;
        solutionClass = new SolutionClass();
        solutionClass.addObjective(TIME_TAKEN_LABEL, true);
        solutionClass.addObjective(SYMMETRIC_ERROR_LABEL, true);
        solutionClass.addBaseline(TIME_TAKEN_BASELINE_LABEL, TIME_TAKEN_LABEL, TIME_TAKEN_BASELINE_VALUE);
        return solutionClass;
    }
    public static void setTimeTakenBaseline(double timeTaken){
        TIME_TAKEN_BASELINE_VALUE = timeTaken;
    }


    /**
     * @return the changeIdentifierSet
     */
    public ChangeIdentifierSet getChangeIdentifierSet() {
        return changeIdentifierSet;
    }
}
